//
//  JMDrawingLayer.swift
//  JMDrawingLayer
//
//  Created by JunMing on 2021/1/29.
//

import UIKit

enum JMDrawingType: Int {
    case DrawingTypeGraffiti = 1        //涂鸦
    case DrawingTypeArrow               //单箭头
    case DrawingTypeLine                //直线
    case DrawingTypeDottedline          //虚线
    case DrawingTypeRulerArrow          //双箭头直线
    case DrawingTypeRulerLine           //双杠直线
    case DrawingTypeOval                //椭圆
    case DrawingTypeCircle              //圆形
    case DrawingTypeRect                //矩形
    case DrawingTypeTriangle            //三角形
    case DrawingTypeArc                 //圆弧
    case DrawingTypeCosine              //正余弦
    case DrawingTypeTrapezoid           //梯形
    case DrawingTypeRhombus             //菱形
    case DrawingTypePentagon            //五边形
    case DrawingTypeHexagon             //六边形
    case DrawingTypeAxis                 //坐标系
    case DrawingTypeRighTangle          //直角坐标系
    case DrawingTypeThreeDCoordinate    //三维坐标系
    case DrawingTypeSphere              //球体
    case DrawingTypeTriangularPyramid   //三菱锥
    case DrawingTypeCone                //圆锥
    case DrawingTypeCylinder            //圆柱
    case DrawingTypeCuboid              //立方体
}

class JMDrawingBaseLayer: CAShapeLayer {
    public var startPoint: CGPoint?
    public var endPoint: CGPoint?
    public var pointArray = [CGPoint]()
    public var drawingType: JMDrawingType = .DrawingTypeGraffiti
    public var lineColor = UIColor.black
    public var layerLineWidth: CGFloat = 2.0
    
    override init() {
        super.init()
        frame = UIScreen.main.bounds
        lineJoin = .round
        lineCap = .round
        strokeColor = UIColor.black.cgColor
        fillColor = UIColor.clear.cgColor
        lineWidth = 2
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}

extension JMDrawingBaseLayer: JMDrawingProtocol {
    
}
